package com.dhr.sarcosuchus.daobase.mybatis.parser.impl;

import com.dhr.sarcosuchus.daobase.pojo.Page;

/**
 * Created by peter.pan on 2016/12/6.
 */

public class MysqlParser extends AbstractSqlParser {

    public String getPageSql(String sql, Page page) {
        return sql + this.getSortSql(page) + " limit " + page.getCurrentResult() + "," + page.getPageSize();
    }

    void getZhSortField(StringBuilder sortSql, String sortField) {
        sortSql.append("CONVERT(").append(sortField).append(" USING gbk)");
    }

    void getNumSortField(StringBuilder sortSql, String sortField) {
        sortSql.append("CONVERT(").append(sortField).append(",SIGNED)");
    }
}
